<?php
/**
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* 
* @copyright Copyright (c) 2008-2009 Ne8, LLC <josh.ribakoff@gmail.com>
* @license New BSD License
* @version 0.1
* @category Shuffler  
* @package Shuffler_Db
*/
class Shuffler_Db_Abstract
{
    protected $factory; 
    
    public function __construct( Shuffler_Db_Factory $factory )
    {
        $this->factory = $factory;
    }
    
    protected function quoteIdentifier( $identifier )
    {
        return $this->factory->getReadAdapter()->quoteIdentifier( $identifier );    
    }
    
    protected function quote( $value )
    {
        return $this->factory->getReadAdapter()->quote( $value );
    }
    
    protected function implodeIdentifiers( array $identifiers )
    {
        return $this->getInflector()->implodeIdentifiers( $identifiers );
    }
    
    protected function implodeValues( array $values )
    {
        return $this->getInflector()->implodeValues( $values );
    }
    
    private function getInflector()
    {
        if( isset( $this->inflector ) ) return $this->inflector;
        $this->inflector = $this->factory->getInflector();
        return $this->inflector;
    }
}